//
//  EmploymentSearch.m
//  CenturyCity
//
//  Created by beisheng03 on 2017/12/27.
//  Copyright © 2017年 beisheng. All rights reserved.
//

#import "EmploymentSearch.h"
#import "ZMSearchController.h"

#import "BaseNavigationController.h"
@interface EmploymentSearch ()
@property (weak, nonatomic) IBOutlet UIView *bgView;
@property (weak, nonatomic) IBOutlet UIView *bigBgView;
@property (weak, nonatomic) IBOutlet UITextField *textField;
@end

@implementation EmploymentSearch



- (void)awakeFromNib{
    [super awakeFromNib];
    
    
    self.bigBgView.backgroundColor = viewBgGrey;
    
    self.bgView.layer.cornerRadius = 18;
    
    self.bgView.layer.masksToBounds = YES;
    
    self.textField.placeholder = @"输入企业名称或行业类别";
    
    self.textField.font = MYFONT(16);
}


- (void)setType:(NSString *)type{
    _type = type;
    
    if ([_type isEqualToString:@"1"]) {
        
       self.textField.placeholder = @"输入企业名称或行业类别";
        
    } else if ([_type isEqualToString:@"2"]){
        
        self.textField.placeholder = @"输入企业名称或职位类别";
        
    } else if ([_type isEqualToString:@"3"]){
        
       self.textField.placeholder =  @"输入商品名称搜索";
        
        
    }else  if ([_type isEqualToString:@"4"]){
        
     self.textField.placeholder = @"请输入小区或街道名称";
        
        
    }else{
        
       self.textField.placeholder = @"输入关键字搜索";
        
        
    }
}




- (IBAction)btnDidTap:(UIButton *)sender {
    
    //    BaseViewController *temp = [[BaseViewController alloc]init];
    //
    //    BaseNavigationController *nav = [[BaseNavigationController alloc]initWithRootViewController:temp];
    //
    //    [self.viewController presentViewController:nav animated:YES completion:nil];
    //
    //    NSLog(@"dfsdfdsfdsfdsf");
    
    
    
    //    PYSearchViewController *searchVC = [PYSearchViewController new];
    //    searchVC.hotSearches = @[@"Java", @"Python", @"Objective-C", @"Swift", @"C", @"C++", @"PHP", @"C#", @"Perl", @"Go", @"JavaScript", @"R", @"Ruby", @"MATLAB"];
    //    searchVC.hotSearchTitle = @"热门标签";
    
    
    //    PYSearchViewController *searchViewController = [PYSearchViewController searchViewControllerWithHotSearches:@[@"Java", @"Python", @"Objective-C", @"Swift", @"C", @"C++", @"PHP", @"C#", @"Perl", @"Go", @"JavaScript", @"R", @"Ruby", @"MATLAB"] searchBarPlaceholder:@"输入关键字搜索" didSearchBlock:^(PYSearchViewController *searchViewController, UISearchBar *searchBar, NSString *searchText) {
    //        // Call this Block when completion search automatically
    //        // Such as: Push to a view controller
    //        [searchViewController.navigationController pushViewController:[[UIViewController alloc] init] animated:YES];
    //
    //    }];
    
    
    
    
    //    searchVC.searchTextField.font = MYFONT(14);
    //
    //    searchVC.searchTextField.textColor = colorWith(42, 144, 131);
    //    [searchVC.searchTextField setValue:[UIColor lightGrayColor] forKeyPath:@"_placeholderLabel.textColor"];
    //    searchVC.searchBar.tintColor = colorWith(42, 144, 131);
    //    searchVC.searchBar.placeholder = @"搜索";
    //    searchVC.searchBar.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
    //    searchVC.searchHistoryStyle = PYSearchHistoryStyleNormalTag;
    //    __weak typeof(searchVC) weakSearchVC = searchVC;
    //    searchVC.didSearchBlock = ^(PYSearchViewController *searchViewController, UISearchBar *searchBar, NSString *searchText) {
    //
    ////        NSString *str = [searchText stringByReplacingOccurrencesOfString:@" " withString:@""];
    //        BaseViewController *vc = [BaseViewController new];
    //        vc.title = searchText;
    //        [weakSearchVC.navigationController pushViewController:vc animated:YES];
    //    };
    
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
    
    flowLayout.sectionInset = UIEdgeInsetsMake(0, 15, 10, 15);
    
    flowLayout.minimumLineSpacing = 10;
    
    flowLayout.minimumInteritemSpacing = 10;
    
    ZMSearchController *temp = [[ZMSearchController alloc]initWithCollectionViewLayout:flowLayout];
    
    temp.type = self.type;
    
    BaseNavigationController *nav = [[BaseNavigationController alloc] initWithRootViewController:temp];
    
    [self.viewController presentViewController:nav animated:YES completion:nil];
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
